//
//  NKLeftHeaderView.m
//  NewKY
//
//  Created by Dee on 2016/11/14.
//  Copyright © 2016年 Dee. All rights reserved.
//

#import "NKLeftHeaderView.h"
#import "NKRegistrUserViewController.h"
@implementation NKLeftHeaderView

-(void)awakeFromNib{
    
    [super awakeFromNib];
    
    [self setBtnImage];
    
}


/**
 从沙盒读取图片病处理圆角
 */
-(void)setBtnImage{
    
    UIImage *headImg = [UIImage new];
    
    NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"avatar.png"];
    
    if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]) {
        
        headImg = [[UIImage alloc]initWithContentsOfFile:fullPath];
        
    }else{
        
        headImg =[UIImage imageNamed:@"An_head"];
    }
    
        //设置圆形图片
    [self.imgButton setBackgroundImage:[[headImg imageByResizeToSize:CGSizeMake(140, 140) contentMode:UIViewContentModeScaleToFill]imageByRoundCornerRadius:90] forState:UIControlStateNormal];
    
}

#pragma mark - 点击事件(Block)
- (IBAction)imgButtonAction:(id)sender {
    
    _pushBlock(@"NKAccountViewController",@"个人信息");
    
}

- (IBAction)registerAction:(id)sender {
    
    _pushBlock(@"NKRegistrUserViewController",@"注册");
    
}

- (IBAction)loginAction:(id)sender {
    
    _pushBlock(@"NKLoginUserViewController",@"登录");
    
}

@end
